﻿/************************************************************************

 This file is part of "10 Second Tim".

 "10 Second Tim" is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 "10 Second Tim" is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with "10 Second Tim".  If not, see <http://www.gnu.org/licenses/>.

************************************************************************/

// All code (c)2013 Scott Bevin. all rights reserved

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace LudumDare27
{
	internal class ScreenBorder
	{
		private Texture2D m_tex;
		private Texture2D m_texLR;

		public ScreenBorder( ContentManager content )
		{
			m_tex = content.Load<Texture2D>( "Img/AlphaBorder" );
			m_texLR = content.Load<Texture2D>( "Img/AlphaBorderLR" );
		}

		public void Render( GraphicsDevice graphics, SpriteBatch sprites )
		{
#if !SILVERLIGHT
			sprites.Begin( );

			Rectangle tbRect = new Rectangle( 0, 0, graphics.PresentationParameters.BackBufferWidth, m_tex.Height );
			sprites.Draw( m_tex, tbRect, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 1.0f );

			tbRect.Y = graphics.PresentationParameters.BackBufferHeight - m_tex.Height;

			sprites.Draw( m_tex, tbRect, null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipVertically, 1.0f );

			Rectangle lrRect = new Rectangle( 0, 0, m_texLR.Width, graphics.PresentationParameters.BackBufferHeight );
			sprites.Draw( m_texLR, lrRect, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 1.0f );

			lrRect.X = graphics.PresentationParameters.BackBufferWidth - m_texLR.Width;
			sprites.Draw( m_texLR, lrRect, null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 1.0f );

			sprites.End( );
#endif
		}
	}
}